package com.lee.controller;

import com.lee.day01.Producer;
import com.lee.day02.NewMessageBinding;
import com.lee.model.OrderModel;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description TODO
 * @Author winston
 * @DateTime 2022/8/25
 */
@RestController
@RequestMapping("/test")
public class TestController {
    @Resource
    private NewMessageBinding newMessageBinding;

    @Resource
    private StreamBridge streamBridge;

//    @Resource
//    private Producer producer;
//    @PostMapping("/rabbitmq/send")
//    public void rabbitSendMessage(@RequestBody OrderModel orderModel) {
//        producer.sendMessage(orderModel);
//    }
//
//    @PostMapping("/kafka/send")
//    public void kafkaSendMessage(@RequestBody OrderModel orderModel) {
//        producer.sendOaMessage(orderModel);
//    }


    @PostMapping("/new/send")
    public void sendWithBridgeForFunctionModel(@RequestBody OrderModel orderModel) {
        streamBridge.send("last-out", orderModel);
    }
}
